package com.tic.robot.ui.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

/**
 * 描述：
 *
 * @author walljiang
 * @since 2016/07/13 10:34
 */
public class PressRelativeLayout extends RelativeLayout {

    public PressRelativeLayout(Context context) {
        super(context);
    }

    public PressRelativeLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public PressRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    float mAlpha = 0.7f;

    public void setmAlpha(float mAlpha) {
        this.mAlpha = mAlpha;
    }

    @Override
    protected void drawableStateChanged() {
        super.drawableStateChanged();
        setAlpha((isPressed() || isFocused() || isSelected()) ? mAlpha : 1.0f);
    }
}
